<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class CustomerInfoValidate extends Validate
{
    protected $rule = [
        'customer_account'=>'require',
        'buyer_name'=>'require',
        'buyer_phone'=>['require', 'regex' => '/^1(3|4|5|6|7|8|9)[0-9]\d{8}$/'],
        'cart_upload'=>'require',
        'purchased_name'=>'require',
        'purchased_file'=>'require',
        'second_name'=>'require',
        'second_phone'=>['require', 'regex' => '/^1(3|4|5|6|7|8|9)[0-9]\d{8}$/'],
//        'cart_ID'=>'require',
        'customer_address'=>'require',
    ];
    protected $message = [
        'customer_account.require'=>'请填写客户身份证号码',
        'buyer_name.require'=>'请填写购买人姓名',
        'buyer_phone.require'=>'请填写购买人手机号',
        'buyer_phone.regex'=>'手机号格式不正确   ',
        'cart_upload.require'=>'请填上传购买人证件',
        'purchased_name.require'=>'请填写墓主姓名',
        'purchased_file.require'=>'请上传墓主火化证明',
        'second_name.require'=>'请填写第二联系人',
        'second_phone.require'=>'请填写第二联系人号码',
        'second_phone.regex'=>'第二联系手机号格式不正确',
//        'cart_ID.require'=>'请填写第二联系人证件号码',
        'customer_address.require'=>'请填写客户详细地址',
    ];

    protected $scene = [
        "save"=>["customer_account","buyer_name","buyer_phone","cart_upload","purchased_name","purchased_file","customer_address"],
        "is_show_save"=>["customer_account","buyer_name","buyer_phone","cart_upload","customer_address"],
    ];
}